package com.ethink.order.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ethink.order.api.info.PurchaseOrderSaleInfo;
import com.ethink.order.api.info.SaleDemandOrderDetailInfo;
import com.ethink.order.api.info.SaleDemandOrderInfo;
import com.ethink.order.api.request.*;
import com.ethink.order.api.response.SaleDemandOrderDetailAddResponse;
import com.ethink.order.api.response.SaleDemandOrderDetailDeleteResponse;
import com.ethink.order.api.response.SaleDemandOrderDetailUpdateResponse;
import com.ethink.order.common.entity.SaleDemandOrderDetail;

import java.math.BigDecimal;
import java.util.List;

/**
 * 销售需求详情单 Service接口
 *
 * @author default
 * @date 2022-10-31
 */
public interface SaleDemandOrderDetailService extends IService<SaleDemandOrderDetail> {

    /**
     * 分页查询
     *
     * @param request
     * @return
     */
    Page<SaleDemandOrderDetailInfo> querySaleDemandOrderDetail(SaleDemandOrderDetailQueryRequest request);

    /**
     * 查询详情
     *
     * @param saleDemandOrderDetailId
     * @return
     */
    SaleDemandOrderDetailInfo getSaleDemandOrderDetailById(Long saleDemandOrderDetailId);

    /**
     * 查询列表
     *
     * @param request
     * @return
     */
    List<SaleDemandOrderDetailInfo> listSaleDemandOrderDetail(SaleDemandOrderDetailQueryRequest request);

    /**
     * 新增
     *
     * @param request
     * @return
     */
    SaleDemandOrderDetailAddResponse addSaleDemandOrderDetail(SaleDemandOrderDetailAddRequest request, String orderNo
            , BigDecimal exchangeRate, BigDecimal defaultTaxRate);

    /**
     * 修改
     *
     * @param request
     * @return
     */
    SaleDemandOrderDetailUpdateResponse updateSaleDemandOrderDetail(SaleDemandOrderDetailUpdateRequest request);

    /**
     * 删除
     *
     * @param saleDemandOrderDetailId
     * @return
     */
    SaleDemandOrderDetailDeleteResponse deleteSaleDemandOrderDetail(Long saleDemandOrderDetailId);

    void batchInsert(List<SaleDemandOrderDetailAddRequest> item, String orderNo, BigDecimal exchangeRate, BigDecimal defaultTaxRate);

    void demandConfirm(SaleDemandOrderConfirmRequest request);

    String lock(SaleDemandOrderLockRequest request);

    void unlock(Long id);

    SaleDemandOrderDetailInfo queryByDetailOrderNo(String detailOrderNo);

    void bulkUpdate(List<SaleDemandOrderDetailUpdateRequest> item, String orderNo);

    SaleDemandOrderDetailInfo queryItemByDetailOrderNo(String detailOrderNo);

    List<PurchaseOrderSaleInfo> queryExceptSalePriceTaxLocal(List<String> purchaseDetailOrderNoList);

    SaleDemandOrderInfo queryMainByDetailId(Long id);
}